package com.tengju.support.domain.model.robot;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import org.springframework.util.StringUtils;

@AllArgsConstructor
public enum ParamType {

    SMS_CODE("短信验证码","短信验证码","smsCodeStrategy"),
    CHANGE_MOBILE("变更手机号","变更手机号","changeMobileStrategy"),
    GET_ID_CODE_BY_MOBILE("用户id","根据手机号获取idCode","getIdCodeByMobileStrategy"),
    GET_MOBILE_BY_ID_CODE("手机号","根据idCode获取手机号","getMobileByIdCodeStrategy"),
    SELF_BONUS("奖励","查询用户业绩奖励","selfBonusStrategy"),
    CHILD_BONUS("奖励构成","查询直属用户业绩奖励","childBonusStrategy"),
    ORDER_ACHIEVEMENT("订单业绩","查询订单带来的业绩","orderAchievementStrategy"),
    ACHIEVEMENT_LOG("业绩趋势","查询业绩趋势","achievementLogStrategy"),
    BONUS_LOG("奖励趋势","查询奖励趋势","bonusLogStrategy"),
    CANCEL_ORDER("取消订单","查询用户时间段内取消订单","bonusCancelOrderStrategy"),


    // 企业微信机器人
    WX_RESET("重置用户","重置用户企业微信，解除微信绑定状态","wxResetStrategy"),
    WX_ADD("新增用户","新增用户企业微信，解除微信绑定状态","wxAddUserStrategy"),
    WX_GEI_USER_INFO("企业微信用户idCode","通过用户idCode查询用户信息","wxGetUserInfoStrategy"),
    WX_CREATE_CHAT("创建群会话","创建群会话","wxCreateChatStrategy"),

    ;

    private String val;
    private String desc;
    private String strategy;

    @JsonValue
    public String getVal() {
        return val;
    }

    public String getStrategy() {
        return strategy;
    }

    @JsonCreator
    public static ParamType fromVal(String val) {
        if (StringUtils.isEmpty(val)) {
            return null;
        }
        for (ParamType type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }


}
